package util

import (
	enum "mall/service/backend/common/enum/user"
)

const (
	UserAssetTypeCash string = "现金"
	UserAssetTypeGem string = "宝石"
	UserAssetTypePoint string = "积分"
)

func GetAssetTypeText(assetType *uint32) (res string) {
	if assetType != nil {
		switch *assetType {
		case enum.UserAssetTypeCash:
			res = UserAssetTypeCash
		case enum.UserAssetTypeGem:
			res = UserAssetTypeGem
		case enum.UserAssetTypePoint:
			res = UserAssetTypePoint
		}
	}

	return
}

func GetChangeTypeText(changeType *uint32) (income bool, res string) {
	if changeType != nil {
		switch *changeType {
		case enum.UserAssetChangeTypeIncrease:
			income = true
		case enum.UserAssetChangeTypeDecrease:
			res = "-"
		}
	}

	return
}

const (
	UserAssetSourceTypeConsume string = "消费"
	UserAssetSourceTypeCharge string = "充值"
	UserAssetSourceTypeRefund string = "退款"
	UserAssetSourceTypeReturn string = "售后"
)

func GetSourceTypeText(sourceType *uint32) (res string) {
	if sourceType != nil {
		switch *sourceType {
		case enum.UserAssetSourceTypeConsume:
			res = UserAssetSourceTypeConsume
		case enum.UserAssetSourceTypeCharge:
			res = UserAssetSourceTypeCharge
		case enum.UserAssetSourceTypeRefund:
			res = UserAssetSourceTypeRefund
		case enum.UserAssetSourceTypeReturn:
			res = UserAssetSourceTypeReturn
		}
	}

	return
}
